//
//  VSaleCurrentListView.m
//  STL_ Animation
//
//  Created by dllo on 16/4/1.
//  Copyright © 2016年 STL. All rights reserved.
//

#import "VSaleCurrentListView.h"
#import "STL.h"
@interface VSaleCurrentListView ()

@property (nonatomic, strong) STLLabel *detailLabel;

@end

@implementation VSaleCurrentListView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = [UIColor clearColor];
        self.detailLabel = [[STLLabel alloc] initWithFrame:self.bounds];
        self.detailLabel.textAlignment = NSTextAlignmentCenter;
        self.detailLabel.textColor = [UIColor colorWithRed:155 / 255.0 green:155 / 255.0 blue:155 / 255.0 alpha:1];
        [self addSubview:self.detailLabel];
        
    }
    return self;
}

- (void)setDynamicModel:(VSaleDynamicModel *)dynamicModel {
    _dynamicModel = dynamicModel;
    
    NSString *numStr = [NSString stringWithFormat:@"第%@期", _dynamicModel.no];
    NSString *detailStr = [NSString stringWithFormat:@"当前打榜 %@-%@ %@", _dynamicModel.beginDateText, _dynamicModel.endDateText, numStr];
    NSRange range = [detailStr rangeOfString:numStr];
    
    NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:detailStr];
    
    [attStr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:8/255.0 green:146/255.0 blue:114/255.0 alpha:1] range:range];
    
    [attStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:13] range:NSMakeRange(0, attStr.length)];
    
    self.detailLabel.attributedText = attStr;
}

@end
